package com.gw2.gw2world;

import com.gw2.gw2world.controller.ServerManager;
import com.gw2.gw2world.controller.Tools;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast;

public class ServerActivity extends Activity implements OnClickListener {
	private ServerManager serverManager;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		Tools.forceLocale(this);
		serverManager=new ServerManager(this);
		serverManager.setMode(ServerManager.MODE_USERCOMMIT);
		View v=serverManager.getView();
		serverManager.setOnOkClickListener(this);
		setContentView(v);
	}
	@Override
	public void onClick(View v) {
		if(v.getId()==serverManager.getOkButtonId()) {
			serverManager.writePreferences();
			if(!serverManager.isHomeSelected()) {
				Toast.makeText(this, R.string.msg_select_server, Toast.LENGTH_SHORT).show();
				return;
			}
			super.finish();
		}
	}
}
